package dpss.replicamanager.gui;

import java.util.Vector;

import javax.swing.table.AbstractTableModel;

import dpss.replicamanager.data.ServerNodes;

/**
 * The Table model that the jTable will use
 * @author musab.mirza
 *
 */
public class NodesTableModel extends AbstractTableModel {

	private Vector<Vector> data;

	String[] columns = { "Address", "Group", "Leader", "Fails", "Faulty" };

	public NodesTableModel(Vector<Vector> data) {
		this.data = data;
	}

	@Override
	public int getColumnCount() {
		return columns.length;
	}

	@Override
	public int getRowCount() {
		return data.size();
	}

	public String getColumnName(int col) {
		return columns[col].toString();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		return data.get(rowIndex).get(columnIndex);
	}

	public void setData(Vector<Vector> data) {
		this.data = data;
	}

	public boolean isCellEditable(int row, int col) {
		return false;
	}
	
	public Vector<Vector> getData(){
		return data;
	}

}
